package svc

import (
	"github.com/zeromicro/go-zero/core/stores/sqlx"
	"gozerogateway/rpc/admin/internal/config"
	"gozerogateway/rpc/model/adminmodel"
)

type ServiceContext struct {
	Config config.Config

	AdminModel adminmodel.GatewayAdminModel
}

func NewServiceContext(c config.Config) *ServiceContext {

	sqlConn := sqlx.NewMysql(c.Mysql.Datasource)
	return &ServiceContext{
		Config: c,

		AdminModel: adminmodel.NewGatewayAdminModel(sqlConn),
	}
}
